package com.scott.juc.executor;

import java.util.Random;

/**
 * @author Scott 2017/11/2 09:15
 */
public class Runner implements Runnable {
    private final Random random = new Random();
    private int index;

    public Runner(int index) {
        this.index = index;
    }

    @Override
    public void run() {


        long time = random.nextInt(10000);

        System.out.println("线程：" + Thread.currentThread().getName() + " -> 目标对象：" + index + "-> 休眠时间为：" + time);

        try {
            Thread.sleep(time);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
